using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using CHEnhanceEfCore.Common;
using CHEnhanceEfCore.Config.Schedule.config;
using Quartz;

namespace CHEnhanceEfCore.Config.Schedule.jobs
{
    [QuartzJob("hello")]
    public class HelloJobs : IJob
    {
        public Task Execute(IJobExecutionContext context)
        {
            return Task.Run(() =>
            {
                List<dynamic> reqObjs = new List<dynamic>()
                {
                    new
                    {
                        projCode = "CRCC-Kwan Lee- Paul Y.",
                        projectUUID = Guid.Parse("55e1e8f9-9d7b-4929-a927-a7f1e105175c")
                    },
                    new
                    {
                        projCode = "China Road and Bridge Corporation",
                        projectUUID = Guid.Parse("df819bcb-0f31-45e4-9561-ca022ddaa793")
                    },
                    new
                    {
                        projCode = "Paul Y.-Chun Wo-CRCC",
                        projectUUID = Guid.Parse("071dc5f9-2604-11ee-8576-064d19b0094a")
                    }
                };
                foreach (dynamic reqObj in reqObjs)
                {
                    Dictionary<string, string> header = new Dictionary<string, string>();
                    header.Add("Access-Key", "4999420e-613c-11ec-90d6-0242ac120003");
                    header.Add("Access-Secret", "5105c576-613c-11ec-90d6-0242ac120003");
                    string url = $"http://127.0.0.1:8686/api/2/Synergos/updateData?projectUUID={reqObj.projectUUID}&projectCode={reqObj.projCode}";
                    HttpHelper.HttpGet(url,headers:header);
                    Console.WriteLine($"$请求{url}");
                }
            });
        }
    }
}